<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script>
        window.onload = function() {
            var div1 = document.getElementById("div1").innerHTML;
            var div2 = document.getElementById("div2").innerHTML;
            function onBtnClick(id,txt) {
                document.getElementById(id).onclick = function() {
                    this.nextSibling.innerHTML = txt;
                }
            }

            onBtnClick("btn1",div1.concat(div2));

        }
    </script>
</head>
<body>
<div id="div1">my name is andy!</div>
<div id="div2">what's your name?</div>
<button id="btn1">concat()</button><span></span> <br />
</body>
</html>
